#ifndef _HEAP_H_
#define _HEAP_H_


#include <windows.h>
#include <string>
#include "SyncObjs.h"

namespace sbase
{
	class CHeap
	{
	public:
		CHeap(const char* pszClassName = NULL);
		~CHeap();
		
	public:
		void*		Alloc(size_t size);
		void		Free(void* ptr);
		bool		IsValidPt(void* p);
	protected:
		HANDLE		m_hHeap;
		LONG		m_lNumAlloc;
		LONG		m_lMaxAlloc;
		std::string	m_strName;

	private:
		sbase::CCriticalSection		m_cs;
	};

}	// end of namespace sbase
	
#endif